package com.examsystem.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.examsystem.common.ResultJson;
import com.examsystem.entity.exame_paper;
import com.examsystem.service.PaperService;

/**
 * 试卷管理
 * @author An-Il
 *
 */
@RestController
@RequestMapping("/sjgl")
public class PaperController {

	@Autowired
	private PaperService paperService;

	//增加试卷
	@PostMapping("/insertPaper")
	public ResultJson insertPaper(exame_paper paper) {
		ResultJson result=null;
		paperService.insertPaper(paper);
		return result;
	}
	
	//修改试卷
	@PostMapping("/updatePaperByKey")
	public ResultJson updatePaperByKey(exame_paper paper) {
		ResultJson result=null;
		paperService.updatePaperByKey(paper);
		return result;
	}
	
	//删除试卷
	@PostMapping("/deletePaperByKey")
	public ResultJson deletePaperByKey(exame_paper paper) {
		ResultJson result=null;
		paperService.deletePaperByKey(paper);
		return result;
	}	
	//查询试卷（模糊查询）试卷ID，名称，科目，出题人，
	@PostMapping("/selectPaperByExample")
	public ResultJson selectPaperByExample(exame_paper paper,
			@RequestParam(defaultValue="1")Integer page,
			@RequestParam(defaultValue="10")Integer pageSize) {
		ResultJson result=null;
		result=paperService.selectPaperByExample(paper,page,pageSize);
		return result;
	}
	
}
